home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Skunkware 5
/
Skunkware 5.iso
/
src
/
X11
/
scripts
/
xroot
< prev
next >
Wrap
Text File
|
1995-05-03
|
4KB
|
177 lines
:
# xroot - selects from a variety of image format files
# for use as a mirror tiled root window
#
# Usage: xroot [-e | -j | -l | -s | -r | -u | -n # | -p # | -N # | -P # |
# -m | directory or file name ]
#
# Takes as an argument the directory in which to find files
# If the argument is not a directory, then it assumes it's an image file
# If the argument is the string "-r", it displays a random GIF from /z/gif.
# If the argument is "-e", it displays a random endo PPM
# If the argument is "-l", it displays a random lyap PPM
# If the argument is "-f", it displays a random Fractal PPM
# If the argument is "-j", it displays a random Julia/Mandelbrot set
# If the argument is "-s", it displays a random Nasa Space GIF
# Additionally, arguments of "-n num" indicate select amongst the 1st num pics
# "-p num" indicates pick the num'th picture
# "-N num" indicates select amongst the 1st num directories
# "-P num" indicates pick the num'th directory
# "-m" indicates use full root window rather than tiling
#
# by Ron Record (rr@sco.com) 10 Sep 1992
#
PROG=$0
GROOT=/usr/skunk/pics/gif
FILE=
TILE="-rmode 2"
DIR=$GROOT/fractals
EDIR=$GROOT/endo
HDIR=$GROOT/hop
MDIR=$GROOT/spore
JDIR=$GROOT/julia
LDIR=$GROOT/lyap
SDIR=$GROOT/xtopo
CMD="xv -perfect -noresetroot -owncmap -root -quit"
DEF_PIC=$LDIR/monsters.gif
NUM=
FNUM=
DNUM=
PNUM=
Usage() {
echo "Usage: $PROG [-p num | -n num | -P num | -N num | -m |"
echo " -e | -j | -l | -r | -s | -f | -u | directory or file name ]"
echo " Where : "
echo " -e indicates display an Endomorphism diagram"
echo " -f indicates display a Fractal picture"
echo " -j indicates display a Julia/Mandelbrot set"
echo " -l indicates display a Lyapunov diagram"
echo " -s indicates display a Nasa image"
echo " -r indicates randomly display saved picture"
echo " -m indicates use full screen rather than tiling"
echo " -u displays this message"
echo "\n$PROG is a shell script front-end for xv."
echo "It was written by Ronald Joe Record and can be used to decorate."
echo "the root window with a GIF, TIFF, PPM or any other image xv reads."
echo "When invoked with no arguments, it displays the monster lyap GIF."
echo "To cycle through a set of images, use croot.\n"
exit 1
}
Select() {
[ -d "$DIR" ] || {
echo "Warning: $DIR does not exist or is not a directory"
exit 1
}
[ "$NUM" = "" ] && NUM=`ls -l $DIR | wc -l`
[ $NUM -gt 255 ] && NUM=255
[ "$FNUM" = "" ] && FNUM=`random $NUM`
i=0
for j in $DIR/*
do
[ "$i" = "" ] && echo "i is empty"
[ "$FNUM" = "" ] && echo "FNUM is empty with NUM = $NUM and DIR=$DIR"
[ $i = $FNUM ] && {
$CMD $TILE $j
break
}
i=`expr $i + 1`
done
}
DirSelect() {
[ "$DNUM" = "" ] && {
DNUM=`ls -l $ARGDIR | wc -l`
DNUM=`expr $DNUM - 1`
}
[ "$PNUM" = "" ] && PNUM=`random $DNUM`
[ $PNUM -gt 255 ] && PNUM=255
i=0
for j in $ARGDIR/*
do
[ "$j" = "$ARGDIR/small" ] && continue
[ $i = $PNUM ] && {
DIR=$j
break
}
i=`expr $i + 1`
done
}
[ $# = 0 ] && {
$CMD $TILE $DEF_PIC
exit 0
}
while case "$1" in
usage) Usage
;;
-m) TILE="-max"
;;
-n) NUM=$2
shift
;;
-p) FNUM=$2
shift
;;
-e) DIR=$EDIR
;;
-h) DIR=$HDIR
;;
-j) DIR=$JDIR
;;
-k) DIR=$MDIR
;;
-l) DIR=$LDIR
;;
-f) ;;
-r) ARGDIR=$GROOT
DirSelect
;;
-s) DIR=$SDIR
;;
"") break
;;
*) if [ -d $1 ]
then
DIR=$1
else
if [ -f $1 ]
then
FILE=$1
else
if [ -f $DIR/$1 ]
then
FILE=$DIR/$1
else
if [ -d $GROOT/$1 ]
then
DIR=$GROOT/$1
else
[ -f $EDIR/$1 ] && FILE=$EDIR/$1
[ -f $JDIR/$1 ] && FILE=$JDIR/$1
[ -f $LDIR/$1 ] && FILE=$LDIR/$1
[ "$FILE" = "" ] && Usage
fi
fi
fi
fi
;;
esac
do
shift
done
if [ "$FILE" = "" ]
then
Select
else
$CMD $TILE $FILE
fi
exit 0